//
//  RootViewController.m
//  Computer
//
//  Created by qianfeng on 15/10/20.
//  Copyright © 2015年 qianfeng. All rights reserved.
//

#import "RootViewController.h"
#import "Header.h"
#import "Function.h"
@interface RootViewController ()<UITableViewDataSource,UITableViewDelegate>

@end

@implementation RootViewController

-(instancetype)initWithTitle:(NSString *)title tabTitle:(NSString *)tabTitle tabImage:(NSString *)image{
    if (self = [super init]) {
        //NavigationItem的title
        self.title = title;
        //设置tabbar
        self.tabBarItem = [[UITabBarItem alloc]initWithTitle:tabTitle image:[UIImage imageNamed:image] selectedImage:nil];
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    //self.view.backgroundColor = [UIColor colorWithRed:arc4random()%255/255.0 green:arc4random()%255/255.0 blue:arc4random()%255/255.0 alpha:1];
    [self createTableView];
}
#pragma mark -NavigationItem相关-
-(void)createBarButtonLeftTitle:(NSString *)leftTitle leftImage:(NSString *)leftImage rightTitle:(NSString *)rightTitle rightImage:(NSString *)rightImage{
    if(leftTitle != nil){
        //创建左按钮
        self.navigationItem.leftBarButtonItem = [Function barButtonTitle:leftTitle image:leftImage target:self sel:@selector(leftBarButtonClick:)];
    }
    if (rightTitle != nil) {
        //创建右按钮
        self.navigationItem.rightBarButtonItem = [Function barButtonTitle:rightTitle image:rightImage target:self sel:@selector(rightBarButtonClick:)];
    }
}
-(void)leftBarButtonClick:(UIBarButtonItem *)btn{
}
-(void)rightBarButtonClick:(UIBarButtonItem *)btn{
}
#pragma mark -UITableView相关-
-(void)createTableView{
    
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT) style:UITableViewStylePlain];
    [self.view addSubview:self.tableView];
    
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
}
#pragma mark -协议-
-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
    return nil;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 0;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 0;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    return nil;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end
